package com.itheima_12;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class test_12_2 {
    public static void main(String[] args) {
        HashMap <Student1,String>map=new HashMap<>();
        Student1 st=new Student1("xiaomei",98,98,88);
        Student1 st1=new Student1("lisi",100,98,88);
        Student1 st2=new Student1("wangwu",89,100,99);
        map.put(st,"湖南");
        map.put(st1,"湖北");
        map.put(st2,"安徽");
        Set<Student1> stk = map.keySet();
        for (Student1 stud : stk) {
            String s = map.get(stud);
            System.out.println(stud+"-----"+s);
        }
        System.out.println("===================================================");
        Set<Map.Entry<Student1, String>> entries = map.entrySet();
        for (Map.Entry<Student1, String> entry : entries) {
            Student1 key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"------"+value);
        }
        System.out.println("===================================================");
        map.forEach(
                (Student1 key,String value)->{
                    System.out.println(key+"------"+value);
                });
    }
}
